<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>面向对象之原型式继承</title>
</head>
<body>

<script>
//    纯净的继承方式---原型式继承
//    原型方式继承是对类式继承的一个封装。封装一个方法传入父类得到子类。
    function Shape() {
        this.bian = '3条边';
        this.shuxing = ['有边','有角'];
    }
    Shape.prototype.area = function () {
        return '你娶我';
    }

    function inhert(o) {
        function Triangle() {
        }
        Triangle.prototype = new o();
        return new Triangle();
    }

    var triangle = inhert(Shape);
    triangle.shuxing.push('修改');
    console.log(triangle.shuxing);

    var fouangle = inhert(Shape);
    console.log(fouangle.shuxing);

</script>
</body>
</html>